/*******************************************************************
 *
 * Copyright (C), 2021-2022, LS, All rights reserved.
 *
 * Author      : 
 * Create Time : 2021-12-22
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
#ifndef _LS_BLE_FILE_IMG_API_H_
#define _LS_BLE_FILE_IMG_API_H_

/*----------------------------Head file----------------------------*/
#include "stdint.h"
#include "ls_ble_file_api.h"
#include "ls_ble_sdk_config.h"

/*----------------------------macro file---------------------------*/

/*----------------------------type define--------------------------*/
#pragma pack(1)

typedef enum {
    IMG_INFO_SUCCESS = 0,
    IMG_INFO_TYPE_ERROR,
    IMG_INFO_SIZE_ERROR,
    IMG_INFO_DEV_BUSY,
    IMG_INFO_DEV_TYPE_ERR,
    IMG_INFO_PROJ_NUM_ERR,
    IMG_INFO_VERSION_ERR,
} img_rsp_err_t;


typedef enum {
	IMG_FILE_TYPE_APP = 0,
    IMG_FILE_TYPE_BLT,
} img_file_type_t;


typedef struct {
	uint32_t file_len;
	uint16_t dev_type;
	uint16_t project_num;
	uint16_t file_crc16;
    uint8_t major_version;
    uint8_t minor_version;
} img_file_info_t;

#pragma pack()

/*----------------------------var define---------------------------*/

/*-------------------------func declaration------------------------*/
extern uint8_t ls_ble_file_set_img_info(uint8_t *payload, uint16_t payload_len, file_trans_t* file_trans);
extern void ls_ble_file_img_rx_raw_data_handle(uint8_t *file_data, uint16_t data_len, file_trans_t* file_trans);
extern uint8_t ls_ble_file_img_trans_done_handle(file_trans_t* file_trans);

/*-----------------------------------------------------------------*/

#endif
